<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta name="author" content="yinq">
<title>登录 - 光年(Light Year Doc)文档管理系统</title>
<link rel="shortcut icon" type="image/x-icon" href="./favicon.ico">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
{load href="/static/css/materialdesignicons.min.css,/static/css/bootstrap.min.css,/static/css/animate.min.css,/static/css/app.min.css" /}

</head>
  
<body>
<!--页面loading-->
<div id="lyear-preloader" class="loading">
  <div class="ctn-preloader">
    <div class="round_spinner">
      <div class="spinner"></div>
      <img src="/static/images/loading-logo.png" alt="">
    </div>
  </div>
</div>
<!--页面loading end-->
<div class="row no-gutters bg-white vh-100">
  <div class="col-md-6 col-lg-7 col-xl-8 d-none d-md-block" style="background-image: url(/static/images/login-bg-1.jpg); background-size: cover;">

    <div class="d-flex vh-100">
      <div class="p-5 align-self-end">
        <img src="/static/images/logo.png" alt="...">
        <br><br><br>
        <p class="text-white">Light Year Doc是一个简单的文档管理系统，基于光年模板v4版本。</p>
      </div>
    </div>

  </div>

  <div class="col-md-6 col-lg-5 col-xl-4 align-self-center">
    <div class="p-5">
      <div class="text-center">
        <a href="index.html"> <img alt="light year doc" src="/static/images/logo-sidebar.png"> </a>
      </div>
      <p class="text-center text-muted"><small>请使用您的账号登录系统</small></p>

      <form action="{:url('login/index')}" class="signin-form needs-validation" method="post" novalidate>
        <div class="form-group">
          <label for="adminname">用户名</label>
          <input type="text" class="form-control" id="adminname" name="adminname" placeholder="请输入您的用户名" required />
        </div>

        <div class="form-group">
          <label for="password">密码</label>
          <input type="password" class="form-control" id="password" name="password" placeholder="请输入您的密码" required />
        </div>

        <div class="form-group row">
          <label class="col-12" for="login-password">验证码</label>
          <div class="col-7">
            <input class="form-control" type="text" name="verify" id="verify" placeholder="请输入验证码" required />
          </div>
          <div class="col-5 text-right">
            <img src="{:url('api/checkcode/getVerify','fontSize=18&imageW=134&imageH=34')}" id="captcha" style="cursor: pointer;"  onclick="this.src=this.src+'?d='+Math.random();" title="点击刷新" alt="验证码" />
          </div>
        </div>

        <div class="form-group">
          <button class="btn btn-block btn-primary" type="submit">立即登录</button>
        </div>
      </form>
      <p class="text-center text-muted mt-3">Copyright © 2021 <a href="http://lyear.itshubao.com">光年文档管理系统</a>. All right reserved</p>
    </div>
  </div>
</div>

{load href="/static/js/jquery.min.js,/static/js/bootstrap-notify.min.js,/static/js/sha1.min.js,/static/js/lyear-loading.min.js" /}
{load href="/static/js/app.min.js,/admin/js/main.min.js"}
<script type="text/javascript">
var loader;
$(document).ajaxStart(function(){
    $("button:submit").html('登录中...').attr("disabled", true);
    loader = $('button:submit').lyearloading({
        opacity: 0.2,
        spinnerSize: 'nm'
    });
}).ajaxStop(function(){
    loader.destroy();
    $("button:submit").html('立即登录').attr("disabled", false);
});
$('.signin-form').on('submit', function(event) {
    if ($(this)[0].checkValidity() === false) {
        event.preventDefault();
        event.stopPropagation();
        $(this).addClass('was-validated');
        return false;
    }
    
    $('#password').val(sha1($('#password').val()));
    var $data  = $(this).serialize();
    
    $.post($(this).attr('action'), $data, function(res) {
        if (res.code) {
            showNotify('登录成功，页面即将跳转~', 'success');
            setTimeout(function () {
                location.href = res.url;
            }, 1500);
        } else {
            showNotify(res.msg, 'danger');
			      $('#password').val('');
            $("#captcha").click();
        }
    }).fail(function () {
	    showNotify('服务器错误~', 'danger');
    });

    return false;
});
</script>
</body>
</html>